package com.tanhua.server.controller;

import com.tanhua.domain.vo.NearUserVo;
import com.tanhua.domain.vo.PageResult;
import com.tanhua.domain.vo.RecommendUserQueryParam;
import com.tanhua.domain.vo.TodayBest;
import com.tanhua.server.interceptor.UserThreadLocal;
import com.tanhua.server.service.TodayBestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("tanhua")
public class TodayBestController {

    @Autowired
    private TodayBestService todayBestService;

    @GetMapping("todayBest")
    public ResponseEntity queryTodayBest() {
        Long userId = UserThreadLocal.getUserId();
        return this.todayBestService.queryTodayBest(userId);
    }

    @GetMapping("recommendation")
    public ResponseEntity queryRecommendUserList(RecommendUserQueryParam queryParam) {
        return this.todayBestService.queryRecommendUserList(queryParam);
    }
//
    /**
     * 查询今日佳人详情
     */
    @GetMapping("{id}/personalInfo")
    public ResponseEntity<TodayBest> queryTodayBest(@PathVariable("id") Long userId) {
        return this.todayBestService.queryTodayBest(userId);
    }

    /**
     * 查询陌生人问题
     */
    @GetMapping("strangerQuestions")
    public ResponseEntity<String> queryQuestion(@RequestParam("userId") Long userId) {
        return this.todayBestService.queryQuestion(userId);
    }

    /**
     * 回复陌生人问题
     */
    @PostMapping("strangerQuestions")
    public ResponseEntity<Void> replyQuestion(@RequestBody Map<String, Object> param) {
        Long userId = Long.valueOf(param.get("userId").toString());
        String reply = param.get("reply").toString();
        return this.todayBestService.replyQuestion(userId, reply);
    }
//
//    /**
//     * 搜附近
//     */
//    @GetMapping("search")
//    public ResponseEntity<List<NearUserVo>> queryNearUser(@RequestParam(value = "gender", required = false) String gender,
//                                                          @RequestParam(value = "distance", defaultValue = "2000") String distance) {
//        List<NearUserVo> list = this.todayBestService.queryNearUser(gender, distance);
//        return ResponseEntity.ok(list);
//    }
//
//
//    /**
//     * 探花
//     */
//    @GetMapping("cards")
//    public ResponseEntity<List<TodayBest>> queryCardsList() {
//        List<TodayBest> list = this.todayBestService.queryCardsList();
//        return ResponseEntity.ok(list);
//    }
//
//    /**
//     * 喜欢
//     */
//    @GetMapping("{id}/love")
//    public ResponseEntity<Void> likeUser(@PathVariable("id") Long likeUserId) {
//        this.todayBestService.likeUser(likeUserId);
//        return ResponseEntity.ok(null);
//    }
//
//    /**
//     * 不喜欢
//     */
//    @GetMapping("{id}/unlove")
//    public ResponseEntity<Void> disLikeUser(@PathVariable("id") Long likeUserId) {
//        this.todayBestService.disLikeUser(likeUserId);
//        return ResponseEntity.ok(null);
//    }


}
